package com.djl.zenithbite.controller.useraddress;


import com.djl.zenithbite.common.request.BaseRequest;
import com.djl.zenithbite.common.response.BaseResponse;
import com.djl.zenithbite.dto.request.useraddress.UserAddressAddRequest;
import com.djl.zenithbite.dto.request.useraddress.UserAddressEditRequest;
import com.djl.zenithbite.service.useraddress.UserAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("api/user/address")
public class UserAddressController {

    @Autowired
    UserAddressService userAddressService;

    @PostMapping("/add")
    public BaseResponse addAddress(@RequestBody UserAddressAddRequest request){
        return userAddressService.addUserAddress(request);
    }

    @PostMapping("/edit")
    public BaseResponse editAddress(@RequestBody UserAddressEditRequest request){
        return userAddressService.editUserAddress(request);
    }

    @GetMapping("/list")
    public BaseResponse queryAddress(){
        return userAddressService.queryUserAddress();
    }

    @GetMapping("/delete")
    public BaseResponse deleteAddress(Integer id){
        return userAddressService.deleteUserAddress(id);
    }
}
